<template>
    <div>
        <h1>App</h1>
        <p>count:{{count}}</p>
        <p>dbCount:{{abc}}</p>
        <button @click="a">累加</button>
        <button @click="b">累减</button>
        <button @click="c({n:6})">加6</button>
        <button @click="addWait">等两秒累加一次</button>
        <button @click="addNWait(6)">等两秒加6</button>
    </div>
</template>

<script>
import {mapState,mapMutations,mapActions,mapGetters} from "vuex"
export default {
    name:"App",
    computed:{
        ...mapState(["count"]),

        //用对象的方式写，可以再起一次名字
        ...mapGetters({
            abc:"dbCount"
        })
    },
    methods: {
        //用对象的方式写，可以再起一次名字
        ...mapMutations({
            a:"add",
            b:"kill",
            c:"addN"
        }),
        ...mapActions(["addWait","addNWait"])
    },
}
</script>

<style>

</style>